package com.yizhuoyan.his.webapi.controller;

import com.yizhuoyan.his.ao.CheckObjectRecordAo;
import com.yizhuoyan.his.dto.JSONResponse;
import com.yizhuoyan.his.service.doctor.outpatient.CheckoutApplicationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class CheckoutApplicationController {
    @Autowired
    CheckoutApplicationService checkoutApplicationService;

    @PostMapping("api/checkout-application")
    public ResponseEntity<JSONResponse> add(CheckObjectRecordAo ao)throws Exception{
        checkoutApplicationService.addCheckProject(ao);
        return ResponseEntity.ok(JSONResponse.ok());
    }

    @GetMapping("api/checkout-application/{id}")
    public ResponseEntity<JSONResponse> delete(Long id)throws Exception{
        checkoutApplicationService.removeCheckProject(id);
        return ResponseEntity.ok(JSONResponse.ok());
    }

}
